﻿using AutoRegistDependency.Attributes;
using HandyWpf.ViewModels.Base.Enum;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace HandyWpf.Converters
{
    [Component]
    public class FormStatus2HeaderConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if(value is FormStatus formStatus)
            {
                string title = (string)parameter;
                switch (formStatus)
                {
                    case FormStatus.Add:
                        return $"新增{title}";
                    case FormStatus.Edit:
                        return $"修改{title}";
                    case FormStatus.Detail:
                        return $"查看{title}";
                }
            }
            return parameter;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
